{template 'common/header'}

<div class="sub-item main panel panel-default" id="table-list">
	<div class="sub-title panel-heading">黑名单</div>
	<div class="panel-body">
	<form action="" method="post" onsubmit="">
	<div class="sub-content table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th width="10%;">选择</th>
					<th width="20%;">用户</th>
					<th width="30%;">昵称</th>
					<th width="40%;">最后发表</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $row}
				<tr>
					<td class="row-first">
						<input type="checkbox" name="select[]" class="checkbox" value="{$row['id']}" />
					</td>
					<td><a href="#">{$row['from_user']}</a></td>
					<td>
						{if $row['nickname']}
						{$row['nickname']}
						{else}
						<span class="label label-danger">未完善</span>
						{/if}
					</td>
					<td>{php echo date('Y-m-d H:i:s', $row['lastupdate']);}</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{if !empty($list)}
		<table class="table">
			<tr>
				<td style="width:50px;" class="row-first"><input type="checkbox" onclick="selectAll(this);" /></td>
				<td>
					<input type="submit" name="delete" value="解除" class="btn btn-primary" />
					<input type="hidden" name="token" value="{$_W['token']}" />
				</td>
			</tr>
		</table>
		{/if}
		{$pager}
	</div>
	</form>
	</div>
</div>

<script type="text/javascript">
	// 全选操作
	function selectAll(obj){
		$('.checkbox').prop('checked', $(obj).prop('checked'));
	}

	require(['jquery'], function($){
		//详细数据相关操作
		var tdIndex;
		$("#table-list thead").delegate("th", "mouseover", function(){
			if($(this).find("i").hasClass("")) {
				$("#table-list thead th").each(function() {
					if($(this).find("i").hasClass("icon-sort")) $(this).find("i").attr("class", "");
				});
				$("#table-list thead th").eq($(this).index()).find("i").addClass("icon-sort");
			}
		});

		$("#table-list thead th").click(function() {
			if($(this).find("i").length>0) {
				var a = $(this).find("i");
				if(a.hasClass("icon-sort") || a.hasClass("icon-caret-up")) { //递减排序
					/*
						数据处理代码位置
					*/
					$("#table-list thead th i").attr("class", "");
					a.addClass("icon-caret-down");
				} else if(a.hasClass("icon-caret-down")) { //递增排序
					/*
						数据处理代码位置
					*/
					$("#table-list thead th i").attr("class", "");
					a.addClass("icon-caret-up");
				}
				$("#table-list thead th,#table-list tbody:eq(0) td").removeClass("row-hover");
				$(this).addClass("row-hover");
				tdIndex = $(this).index();
				$("#table-list tbody:eq(0) tr").each(function() {
					$(this).find("td").eq(tdIndex).addClass("row-hover");
				});
			}
		});

	});
</script>

{template 'common/footer'}